package cn.doctorpda.conference.model;

import org.json.JSONObject;

import cn.doctorpda.conference.config.AppConfig;
import cn.doctorpda.conference.okhttp.OkHttpUtils;
import cn.doctorpda.conference.okhttp.callback.Callback;
import cn.doctorpda.conference.utils.AESUtil;
import cn.doctorpda.conference.utils.L;

/**
 * Created by huangjinlong on 2016/5/19.
 * 注册
 */
public class GetRegisterModel implements IPostModel{

    @Override
    public void postNetWorkStringData(String url, Callback callback, String... parameter) {
        JSONObject object = new JSONObject();
        try {
            object.put("mobile", parameter[0]);
            object.put("mobile_vc", parameter[1]);
            object.put("username", parameter[2]);
            object.put("password", parameter[3]);
        } catch (Exception e){
            e.printStackTrace();
        }
        String data = AESUtil.encrypt(object.toString(), AppConfig.AES_KEY);
        OkHttpUtils.post()
                .url(url)
                .addParams("data", data)
                .addParams("encrpt_flag", "1")
                .build()
                .execute(callback);
    }
}
